/* eslint-disable max-params */
import { request } from '../request';

export function fetchModelTypeByTimeAndAreaName(startTime: string, endTime: string, areaName: string) {
  return request.get<Array<string>>(
    `/report/getModelTypeByTimeAndAreaName?startTime=${startTime}&endTime=${endTime}&areaName=${areaName}`
  );
}

export function fetchModelType() {
  return request.get<Array<string>>(`/report/getModelType`);
}

export function fetchProductSpecAll() {
  return request.get<Array<string>>(`/report/getProductSpec`);
}

export function fetchProductRequestAll() {
  return request.get<Array<string>>(`/report/getProductRequest`);
}

export function fetchProcessOperationAll() {
  return request.get<Array<string>>(`/report/getProcessOperation`);
}
export function fetchProductSpecByTimeAndAreaName(startTime: string, endTime: string, areaName: string) {
  return request.get<Array<string>>(
    `/report/getProductSpecByTimeAndAreaName?startTime=${startTime}&endTime=${endTime}&areaName=${areaName}`
  );
}

export function fetchFpyData(startTime: string, endTime: string, areas: string, modelType: string, panelType: string) {
  return request.get<Array<any>>(
    `/report/getFpyData?startTime=${startTime}&endTime=${endTime}&areas=${areas}&modelType=${modelType}&panelType=${panelType}`
  );
}

export function fetchFpyLotList(
  startTime: string,
  endTime: string,
  dateTime: string,
  area: string,
  modelType: string,
  operation: string
) {
  return request.get<Array<any>>(
    `/report/getFpyLotList?startTime=${startTime}&endTime=${endTime}&dateTime=${dateTime}&area=${area}&modelType=${modelType}&operation=${operation}`
  );
}

export function fetchFpyLotListByChart(
  startTime: string,
  endTime: string,
  dateTime: string,
  area: string,
  modelType: string
) {
  return request.get<Array<any>>(
    `/report/getFpyLotListByChart?startTime=${startTime}&endTime=${endTime}&dateTime=${dateTime}&area=${area}&modelType=${modelType}`
  );
}

export function fetchYieldTrandData(
  startTime: string,
  endTime: string,
  area: string | null | undefined,
  modelType: string | null | undefined,
  productSpec: string | null | undefined,
  processOperation: string | null | undefined,
  searchType: string
) {
  return request.get<Array<QualityReport.YieldTrandData>>(
    `/report/getyieldTrandData?startTime=${startTime}&endTime=${endTime}&area=${area}&modelType=${modelType}&productSpec=${productSpec}&processOperation=${processOperation}&searchType=${searchType}`
  );
}

export function fetchYieldDistributeData(
  startTime: string,
  endTime: string,
  modelType: string,
  productSpec: string,
  searchType: string
) {
  return request.get<Array<QualityReport.FpyData>>(
    `/report/getYieldDistributeData?startTime=${startTime}&endTime=${endTime}&modelType=${modelType}&productSpec=${productSpec}&searchType=${searchType}`
  );
}

export function fetchDefectDistributeData(
  startTime: string,
  endTime: string,
  area: string,
  modelType: string,
  productSpec: string,
  processOperation: string,
  searchType: string
) {
  return request.get<Array<QualityReport.FpyData>>(
    `/report/getDefectDistributeData?startTime=${startTime}&endTime=${endTime}&area=${area}&modelType=${modelType}&productSpec=${productSpec}&processOperation=${processOperation}&searchType=${searchType}`
  );
}

export function fetchRealWip() {
  return request.get<any[]>(`/report/getRealWip`);
}

export function fetchProWip(areaName: string, lotName: string, productSpecName: string, processoperationName: string) {
  return request.get<any[]>(
    `/report/getProWipV2?areaName=${areaName}&lotName=${lotName}&productSpecName=${productSpecName}&processoperationName=${processoperationName}`
  );
}

export function fetchLotByParentLot(parentlotname: string) {
  return request.get<any[]>(`/report/getLotByParentLot?parentlotname=${parentlotname}`);
}

export function fetchProLotList(startTime: string, endTime: string) {
  return request.get<any[]>(`/report/getProLotList?startTime=${startTime}&endTime=${endTime}`);
}

export function fetchShipBoxList(startTime: string, endTime: string, lotName: string) {
  return request.get<any[]>(`/report/getShipBoxList?startTime=${startTime}&endTime=${endTime}&lotName=${lotName}`);
}

export function fetchMachineAlarmList(startTime: string, endTime: string) {
  return request.get<any[]>(`/report/getMachineAlarmList?startTime=${startTime}&endTime=${endTime}`);
}

export function fetchProAlarmList(
  startTime: string,
  endTime: string,
  areaName: string,
  productSpecName: string,
  processoperationName: string,
  lotName: string,
  userName: string
) {
  return request.get<any[]>(
    `/report/getProAlarmList?startTime=${startTime}&endTime=${endTime}&areaName=${areaName}&productSpecName=${productSpecName}&processoperationName=${processoperationName}&lotName=${lotName}&userName=${userName}`
  );
}

export function fetchMdcMaterialTypeList() {
  return request.get<any[]>(`/report/getMdcMaterialTypeList`);
}

export function fetchMdcMaterialList(
  startTime: string,
  endTime: string,
  areaName: string,
  materialName: string,
  materialType: string,
  lotName: string
) {
  return request.get<any[]>(
    `/report/getMdcMaterialList?startTime=${startTime}&endTime=${endTime}&areaName=${areaName}&materialName=${materialName}&materialType=${materialType}&lotName=${lotName}`
  );
}

export function fetchMdcMaterialHis(materialName: string, lotNo: string, workOrderId: string) {
  return request.get<any[]>(
    `/report/getMdcMaterialHis?materialName=${materialName}&lotNo=${lotNo}&workOrderId=${workOrderId}`
  );
}

export function fetchStepOutData(startTime: string, endTime: string, areas: string) {
  return request.get<any[]>(`/report/getStepoutData?startTime=${startTime}&endTime=${endTime}&areas=${areas}`);
}

export function fetchStepOutLotList(dateTime: string, area: string, modelType: string, operation: string) {
  return request.get<Array<any>>(
    `/report/getStepOutLotList?dateTime=${dateTime}&area=${area}&modelType=${modelType}&operation=${operation}`
  );
}

export function fetchMaterialUsege(startTime: string, endTime: string, areas: string, processoperationName: string) {
  return request.get<any[]>(
    `/report/getMaterialUsege?startTime=${startTime}&endTime=${endTime}&areas=${areas}&processoperationName=${processoperationName}`
  );
}

export function fetchMaterialTotalUsege(
  startTime: string,
  endTime: string,
  areas: string,
  processoperationName: string
) {
  return request.get<any[]>(
    `/report/getMaterialTotalUsege?startTime=${startTime}&endTime=${endTime}&areas=${areas}&processoperationName=${processoperationName}`
  );
}

export function fetchPmResultList(startTime: string, endTime: string) {
  return request.get<any[]>(`/report/getPmResult?startTime=${startTime}&endTime=${endTime}`);
}

export function fetchFinanceFpyData(startTime: string, endTime: string) {
  return request.get<any[]>(`/report/getFinanceFpyData?startTime=${startTime}&endTime=${endTime}`);
}

export function fetchWipDailyData(startTime: string, endTime: string) {
  return request.get<any[]>(`/report/getFinanceWipDailyData?startTime=${startTime}&endTime=${endTime}`);
}

export function fetchFinanceLotData(startTime: string, endTime: string) {
  return request.get<any[]>(`/report/getFinanceLotData?startTime=${startTime}&endTime=${endTime}`);
}
